package com.es.elasticsearch.dao.mysql;

import com.es.elasticsearch.model.mysql.MysqlBolg;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Auther: Administrator
 * @Date: 2019-12-30 15:33
 * @Description:
 */
@Component
public interface BlogDao extends JpaRepository <MysqlBolg,Integer>{

    @Query("select e from MysqlBolg e order by e.createTime desc  ")
    List<MysqlBolg> queryAll();

    @Query("select e from MysqlBolg e where e.title like concat('%',:keyword,'%' ) or e.content like concat('%',:keyword,'%' ) ")
    List<MysqlBolg> queryBlogs(@Param("keyword") String keyword);
}
